#ifndef CHESS_GAME_HPP_
#	define CHESS_GAME_HPP_

#	include "../Chess.hpp"
#	include <map>
#	include <list>


using namespace std;

class View;

class ChessGame
{
	public:
		static ChessGame*	getInstance();
		~ChessGame();
	
		void				init();
		void				scanStateUpdate();
		void 				doAction(Action* action);
		void				doMoveAction(unsigned short hash_key);
	
		void				reset();
		void				save(string filename);
		void				load(string filename);
	
		View*				getView() const;
		Chess::Color		getCurrentPlayer() const;
	
	private:

		ChessGame();
		void				waitingForAction();
		void				waitingForPawnPromotion();
		void				gameOver();
		
		static ChessGame*							instance;
		Chess::GameState							state;
		map<unsigned short, MoveAction*>			mactions;
		map<CastlingAction::Type, CastlingAction*>	cactions;
		Piece*										ppawn;
		View*										view;
};


#endif
